import request from '@/utils/request'

export function developerList(params) {
  return request({
    url: '/online/developer-admin/developer', params,
    method: 'GET'
  })
}

export function developerListByCountry(params) {
  return request({
    url: '/online/developer-admin/developer/country/list', params,
    method: 'GET'
  })
}

export function developerCheckAssistList(params) {
  return request({
    url: '/online/developer-admin/developer/assist/list', params,
    method: 'GET'
  })
}

export function getDeveloperInfo(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}`,
    method: 'GET'
  })
}
export function developerAppList(params) {
  return request({
    url: `/online/developer-admin/developer/app`, params,
    method: 'GET'
  })
}
export function getDeveloperApp(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/app`,
    method: 'GET'
  })
}
export function appStoreAppList(params) {
  return request({
    url: `/online/developer-admin/developer/app`, params,
    method: 'GET'
  })
}
export function lockDeveloper(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/lock`,
    method: 'POST'
  })
}
export function unlockDeveloper(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/unlock`,
    method: 'POST'
  })
}
export function deleteDeveloper(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/delete`,
    method: 'POST'
  })
}
export function closeDeveloper(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/close`,
    method: 'POST'
  })
}
export function applyCert(data) {
  return request({
    url: `/online/developer-admin/developer/apply/cert`, data,
    method: 'POST'
  })
}
export function getCsrInfo(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/csr`,
    method: 'GET'
  })
}

export function checkDeveloper(developerId, data) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/examine`,
    method: 'POST',
    data
  })
}

export function getRegisterNoticeEmail() {
  return request({
    url: `/online/developer-admin/developer/register/notice/email/list`,
    method: 'GET'
  })
}

export function saveRegisterNoticeEmail(data) {
  return request({
    url: `/online/developer-admin/developer/register/notice/email`, data,
    method: 'POST'
  })
}

export function deleteRegisterNoticeEmail(id) {
  return request({
    url: `/online/developer-admin/developer/register/notice/email/${id}`,
    method: 'DELETE'
  })
}
// {developerId : ${developerId},  remark : ${remark}}
export function updateRemark(data) {
  return request({
    url: `/online/developer-admin/developer/${data.developerId}/remark`,
    data,
    method: 'POST'
  })
}

// get developer ApplicationCount
export function getMyApplicationCount(developerId) {
  return request({
    url: `/online/developer/statistic/${developerId}/application/count`,
    method: 'get'
  })
}

export function getReleasedApplicationCount(developerId) {
  return request({
    url: `/online/developer/statistic/${developerId}/application/published`,
    method: 'get'
  })
}

export function getProgressApplicationCount(developerId) {
  return request({
    url: `/online/developer/statistic/${developerId}/application/release-progress`,
    method: 'get'
  })
}

export function getAppStatisticsList(developerId, params) {
  return request({
    url: `/online/developer/statistic/${developerId}/app-install/list`,
    method: 'get',
    params
  })
}

export function getAppStatistics(developerId) {
  return request({
    url: `/online/developer/statistic/${developerId}/application/install/trend`,
    method: 'get'
  })
}

export function saveCheckAssist(data) {
  return request({
    url: `/online/developer-admin/developer/check/assist`, data,
    method: 'POST'
  })
}

export function saveCheckAssistResult(data) {
  return request({
    url: `/online/developer-admin/developer/check/assist/result`,
    data,
    method: 'POST'
  })
}

export function queryCheckAssistResult(params) {
  return request({
    url: `/online/developer-admin/developer/check/assist/result`,
    params,
    method: 'get'
  })
}

export function developerAreaExamine(data) {
  return request({
    url: `/online/developer-admin/developer/${data.developerId}/area-examine`,
    data,
    method: 'POST'
  })
}

// 添加个人开发者（按文件导入）
export function addPersonalDeveloperByFile(data) {
  return request({
    url: `/online/developer-admin/developer/import-personal-developer`,
    method: 'post',
    data,
    timeout: 1000 * 60 * 10
  })
}

// 添加公司开发者（按文件导入）
export function addCompanyDeveloperByFile(data) {
  return request({
    url: `/online/developer-admin/developer/import-company-developer`,
    method: 'post',
    data,
    timeout: 1000 * 60 * 10
  })
}

// 创建开发者（参数同注册开发者接口）
export function createDeveloper(data) {
  return request({
    url: `/online/developer-admin/developer/create`,
    data,
    method: 'POST'
  })
}

export function queryCheckAssist(params) {
  return request({
    url: `/online/developer-admin/developer/check/assist/${params.userId}/${params.developerId}`,
    params,
    method: 'get'
  })
}

// 查看UsbKey列表
// {usbKeySn : ${usbKeySn},  pageNo : ${pageNo},  pageSize : ${pageSize}}
export function queryUsbKeyList(params) {
  return request({
    url: `/online/developer-admin/developer/usb-key`,
    params,
    method: 'get'
  })
}

// 查看绑定UsbKey列表
// {developerId : ${developerId}}
export function queryBoundUsbKeyList(developerId) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/usb-key`,
    method: 'get'
  })
}

// 绑定UsbKey
// {developerId : ${developerId}, usbKeySns : {usbKeySn1, usbKeySn2, usbKeySns...}}
export function bindUsbKeyList(developerId, data) {
  return request({
    url: `/online/developer-admin/developer/${developerId}/bind/usb-key`,
    data,
    method: 'post'
  })
}

// {developerId : ${developerId},  rejectReason : ${rejectReason}}
export function rejectDeveloper(data) {
  return request({
    url: `/online/developer-admin/developer/${data.developerId}/reject`,
    data,
    method: 'POST'
  })
}

export function updateDeveloperEmail(userId, data) {
  return request({
    url: `/online/developer-admin/developer/${userId}/update/email`, data,
    method: 'POST'
  })
}

// 查看开发者审核记录列表
// {developerId : ${developerId}}
export function getDeveloperAuditRecordList(params) {
  return request({
    url: `/online/developer-admin/developer/audit/records`,
    params,
    method: 'get'
  })
}
